﻿
<html>
<head>
    <meta charset="UTF-8" />
    <title>Nodejs -  手機網頁</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
        <meta name="author" content="patw, Patrick Wang" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="http://140.96.29.30/nodejs-svn/socketio/chatApp/socket.io.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(document).ready(function() {
 
        // ==========================================================================================================================
        // 建立 Socket IO 連線
        // ==========================================================================================================================
        var socket = io.connect("http://140.96.29.30:8081");
        "undefined" != typeof console && console.log("user enter via mobile");
        // ==========================================================================================================================
        "undefined" != typeof console && console.log("enter mobile page");
        
        
        socket.emit("send", {
            key: "<?php echo $_GET['key'];?>",
            act: "enter"
        });
 
        $("#change_btn").click(function(){
            "undefined" != typeof console && console.log("send change color command");
            
            socket.emit("send", {
                key: "<?php echo $_GET['key'];?>",
                act: "changebg"
            });
          //  alert("<?php echo $_GET['key'];?>");
        });
        
        $("#textSubmit").click(function(){
            socket.emit("send", {
                key: "<?php echo $_GET['key'];?>",
                msg: $("#msgInput").val(), 
                act: "inputMsg"
            });
        });
         
    });
    </script>
</head>
<body>
 
<p>打開手機網頁成功！快看看你的電腦螢幕吧！</p>
 
<input id="change_btn" type="button" value="控制電腦端變背景色" />
<br/>

<input id="msgInput" type="input" value=""  />
<input id="textSubmit" type="button" value="輸入" />
</body>
</html>